package cn.buddha.jesj.thread.executor;

import lombok.extern.slf4j.Slf4j;

/**
 * @author shihao
 * @description 呵呵计算
 */
@Slf4j
public class CalcHe implements CalcInterface {

    /**
     * 假设耗时 3 秒
     */
    @Override
    public String calc(String say) {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException("CalcHe sleep interrupted exception");
        }

        log.info("{} executing", Thread.currentThread().getName());

        // 异常情况测试
        if ("呵呵".equals(say)) {
            throw new RuntimeException("呵呵你妹呢!");
        }

        return "1";
    }

}
